package com.moyoutian.leetcode;

public class Demo7 {
    public static void main(String[] args) {
        System.out.println("Demo7.main" + reverse(-1233));
    }
    public static int reverse(int x) {
        long temp = 0;
        while (x != 0) {
            temp = temp * 10 + x % 10;
            x = x / 10;
        }
        if (temp > Integer.MAX_VALUE || temp < Integer.MIN_VALUE) {
            temp = 0;
        }
        return (int) temp ;
    }
}
